from db.dbUtils import MysqlPool


def get_major_by_m_id(m_id):
    with MysqlPool() as pool:
        c = pool.cursor
        sql = "select * from `se_major` where `m_id`={}".format(m_id)
        c.execute(sql)
        r = c.fetchall()
        if r:
            return r[0]
        return None


def get_majors_by_f_id_dao(f_id):
    sql = """
    select * from `se_major` where `f_id`={}
    """.format(f_id)
    with MysqlPool() as pool:
        c = pool.cursor
        c.execute(sql)
        return c.fetchall()


